<style type="text/css">
    .layui-form-select dl{z-index:9999;}
</style>
<form class="layui-form" action="{:url()}" method="post" id="editForm">
    <div class="layui-form-item">
        <label class="layui-form-label">选择供应商</label>
        <div class="layui-input-inline w200">
            <select name="supplier_id" class="field-supplier_id" type="select" lay-verify="required" lay-search="">
                <option value="">请选择供应商</option>
                {$suppliers|raw}
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">金额</label>
        <div class="layui-input-inline w200">
            <input type="text" class="layui-input field-price" name="price" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">支付账户</label>
        <div class="layui-input-inline w200">
            <select name="account_id" class="field-account_id" type="select" lay-verify="required" lay-filter="account_id" lay-search="">
                <option value="">请选择支付账户</option>
                {$accounts|raw}
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux account_balance">必填项</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-inline" style="">
            <textarea name="bak" class="layui-textarea field-bak">{if (isset($formData['content']))}{$formData['content']}{/if}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" class="field-id" name="id">
            <button type="submit" class="layui-btn layui-btn-normal" hisi-data="{pop: true, refresh: true}" lay-submit="" lay-filter="formSubmit">提交</button>
            <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
        </div>
    </div>
</form>
{include file="system@block/layui" /}
<script>
layui.use(['upload', 'func'], function() {
    var $ = layui.jquery, layer = layui.layer, upload = layui.upload, func = layui.func,form = layui.form;
    // 编辑模式下表单自动赋值
    func.assign({:json_encode($formData)});
    form.on('select(account_id)', function (data) {
        var account_id = data.value
        $.ajax({
            url:"{:url('getAccountBalance')}",
            type:'get',
            data:{account_id:account_id},
            success:function(res){
                $('.account_balance').html('账户余额：'+res+'元');
            }
        })
    });

});
</script>
{:editor(['content'])}
